"""
将以前的微信提现状态放到系统提现记录中
"""
import os
import sys
import django

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.extend([BASE_DIR, ])
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "finance_c2c.settings")
django.setup()

from apps.supply_order.models import TransferRecord


def add_record_key():
    for i in TransferRecord.objects.all():
        if i.wx_transfer_error_code.return_code == "SUCCESS" and i.wx_transfer_error_code.result_code == "SUCCESS":
            i.status = True
        else:
            i.status = False
        i.partner_trade_no = i.wx_transfer_error_code.partner_trade_no
        i.save()


if __name__ == '__main__':
    add_record_key()
